﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <link href="../Plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <link href="../zui/lib/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../Plugins/keyboard/css/keyboard.min.css" rel="stylesheet" />
    <link href="../Plugins/pinyin/simple-input-method.css" rel="stylesheet" />
    <link href="../zui/css/font-awesome.min.css" rel="stylesheet" />
    <link href="../zui/css/zui.min.css" rel="stylesheet" />
    <link href="../Plugins/sweetalert/sweetalert.css" rel="stylesheet" />
    <link href="../Plugins/jquery-step/jquery.steps.css" rel="stylesheet" />
    <link href="../zui/css/app.css" rel="stylesheet" />
    <title></title>
    <style type="text/css">
        .wizard > .steps > ul > li {
            width: 20% !important;
        }

        .wizard .content {
            min-height: 473px !important;
            /*width: 580px;*/
            margin: 0px !important;
        }

        .wizard > .content > .body {
            width: 100% !important;
            /*height: 100% !important;*/
            border-color: #d0c8c8 !important;
            border-width: 1px;
            border-style: solid;
        }

        .form-control {
            height: 40px;
            line-height: 30px;
        }

        .actions {
            display: none !important;
        }

        #example-basic-t-0 {
            margin-left: 0px !important;
        }

        .form-control {
            font-size: 15px !important;
        }

        .form-group {
            font-size: 15px !important;
        }

        /*.btn {
            height: 50px;
            font-size: 18px !important;
        }*/
        .wizard > .steps a, .wizard > .steps a:hover, .wizard > .steps a:active {
            padding: 5px 10px !important
        }

        .container {
            max-width: 930px !important;
            width: 960px !important
        }
   .sweetAlert {
        width: 22em;
        margin: 0 auto;
        top: 300px;
        left: 512px;
        right: 0;
    }
    </style>
</head>
<body>
    <div class="container" style="padding-left:0px !important; padding-right:0px !important; display:none">
        <div id="example-basic">
            <h3>准备</h3>
            <section style="height:282px !important;overflow-y: scroll !important;">
                <form class="form-horizontal" style="width:450px;padding-left:5px;">
                    <fieldset>

                        <div class="form-group" style="display:none">
                            <label for="exampleInputAccount4" class="col-xs-4">试验材料</label>
                            <div class="col-xs-8">
                                <input type="text" class="form-control" value="试样1" id="txtSycl" placeholder="">
                            </div>
                        </div>


                        <div class="form-group">
                            <label for="exampleInputPassword4" class="col-xs-4">试验时长</label>
                            <div class="col-xs-8">
                                <div class="input-group">
                                    <input id="txtSysc" type="number" class="form-control numkeyboard" min="0.001" max="200" value="168">
                                    <span class="input-group-addon">h</span>
                                </div>
                            </div>
                        </div>

                          <div class="form-group">
                            <label for="exampleInputText2" class="col-xs-4">取样间隔</label>
                            <div class="col-xs-8">
                                <div class="input-group">
                                    <input id="txtInterval" type="number" class="form-control numkeyboard" min="0.001" max="200" value="24">
                                    <span class="input-group-addon">h</span>
                                </div>
                            </div>
                        </div>


                        <div class="form-group">
                            <label for="exampleInputText3" class="col-xs-4">环境温度</label>
                            <div class="col-xs-8">
                                <div class="input-group">
                                    <input id="txtSywd" type="number" class="form-control numkeyboard" min="10" max="100"  value="25">
                                    <span class="input-group-addon">°C</span>
                                </div>
                            </div>
                        </div>

                         <div class="form-group">
                            <label for="exampleInputText4" class="col-xs-4">光照强度</label>
                            <div class="col-xs-8">
                                <div class="input-group">
                                    <input id="txtIntensity" type="number" class="form-control numkeyboard" min="10" max="100"  value="100">
                                    <span class="input-group-addon">μW/cm2</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="exampleInputText5" class="col-xs-4">备注信息</label>
                            <div class="col-xs-8">
                                <textarea class="form-control numkeyboard" rows="3" id="txtBz"></textarea>
                            </div>
                        </div>
                    </fieldset>
                </form>
                <div class="shiyan-footer" style="position: fixed">
                    <button style="float:left;margin-right:5px;height: 50px;" class="btn btn-danger  btn-lg home-btn" type="button">返回主菜单</button>
                    <button style="float:right; height: 50px;" class="btn btn-primary  btn-lg" id="step1-btn" type="button">下一步</button>
                </div>
            </section>
            <h3>试验过程</h3>
            <section style="height:350px !important;display:block;overflow-y:hidden !important;padding-bottom:0px!important;">
                <iframe frameborder="0" id="content-frame1" class="content-frame" allowtransparency="true" scrolling="no" width="580"  src="ShiYan.html?index=1"></iframe>
            </section>
            <h3>结果</h3>
            <section style="height:350px !important;display:block;overflow-y:hidden !important;padding-bottom:0px!important;padding-top:15px !important">
                <iframe frameborder="0" id="content-frame3" class="content-frame result-frame" allowtransparency="true" scrolling="no" width="580" src="#"></iframe>
            </section>
        </div>
    </div>

    <script src="../zui/lib/jquery/jquery.js"></script>
    <script src="../Plugins/pinyin/pinyin_dict_notone.js"></script>
    <script src="../Plugins/pinyin/pinyin_dict_withtone.js"></script>
    <script src="../Plugins/pinyin/pinyinUtil.js"></script>
    <script src="../Plugins/pinyin/simple-input-method.js"></script>
    <script src="../Plugins/jquery-ui/jquery-ui.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.keyboard.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.mousewheel.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.keyboard.extension-mobile.min.js"></script>
    <script src="../zui/lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="../zui/lib/layer/layer.js"></script>
    <script src="../zui/lib/swiper/js/swiper.min.js"></script>
    <script src="../Plugins/sweetalert/sweetalert.min.js"></script>
    <script src="../Plugins/jquery-step/jquery.steps.min.js"></script>
    <script src="../zui/js/utils.js"></script>
    <script src="../zui/js/app.js"></script>
    <script type="text/javascript">
        var tFlag = true;
        var shiyan = true;
        var t = 0;
        var steps;
        $(function () {

            sessionStorage.syIndex = 0;
            $("#userinfo-btn", top.document).addClass('disabled');
            steps = $("#example-basic").steps({
                headerTag: "h3",
                bodyTag: "section",
                transitionEffect: "slideLeft",
                autoFocus: true
            });
            $(".container").show();
            $('.numkeyboard').keyboard(keyBordSetting);
            $("#step1-btn").click(function () {
                var txtSycl = $("#txtSycl").val();
                var txtSywd = $("#txtSywd").val();
                var txtSysc = $("#txtSysc").val();
                var txtSyType = getUrlParam("type");
                var txtInterval = $("#txtInterval").val();
                var txtIntensity = $("#txtIntensity").val();
                var txtBz = $("#txtBz").val();
                if (txtSycl.trim() == "") {
                    swal({
                        title: '提示',
                        text: '试验材料不能为空',
                        type: 'warning',
                        customClass: 'sweetAlert sweetAlert2'
                    });
                    return;
                }

                if (txtSysc.trim() == "") {
                    swal({
                        title: '提示',
                        text: '试验时长不能为空',
                        type: 'warning',
                        customClass: 'sweetAlert sweetAlert2',
                    });
                    return;
                }

                if (txtInterval.trim() == "") {
                    swal({
                        title: '提示',
                        text: '取样间隔不能为空',
                        type: 'warning',
                        customClass: 'sweetAlert sweetAlert2',
                    });
                    return;
                }
                if (txtIntensity.trim() == "") {
                    swal({
                        title: '提示',
                        text: '光照强度不能为空',
                        type: 'warning',
                        customClass: 'sweetAlert sweetAlert2',
                    });
                    return;
                }

                if (txtSywd.trim() == "") {
                    swal({
                        title: '提示',
                        text: '环境温度不能为空',
                        type: 'warning',
                        customClass: 'sweetAlert sweetAlert2',
                    });
                    return;
                }

                var user = JSON.parse(sessionStorage.LoginUser);
                var loadingIndex = top.layer.msg('正在初始化环境...', {
                    time: 0, icon: 16, shade: 0.01
                });
                $.ajax({
                    url: sessionStorage.CurrentHttpAddress + "/insertExperiment",
                    type:"get",
                    data: {
                        experiment_type: txtSyType, material_name: txtSycl,
                        set_temp: txtSywd, description: txtBz,
                        set_light: txtIntensity, sampling_reminder: txtInterval,
                        user_id: user.user_id, user_name: user.user_name

                    },
                    context: document.body,
                    success: function (res) {
                        if (res.indexOf('error') != -1) {
                            alert(res);
                            return;
                        }
                        var experimentId = res;
                        sessionStorage.CurrentExperimentId = experimentId;
                        sessionStorage.Sylx = 1;
                        var totalsecond = parseFloat(txtSysc) * 3600;
                        var timeStr = (Math.floor(totalsecond / 3600)) + "时" + Math.floor((totalsecond % 3600) / 60) + "分" + (totalsecond % 60) + "秒"
                        $(".content-frame").each(function () {

                            $(this).contents().find("#Sycl").text(txtSycl);
                            $(this).contents().find("#Sywd").text(txtSywd);
                            $(this).contents().find("#Gzqd").text(txtIntensity);
                            $(this).contents().find("#Sysc").text(txtSysc);
                        });
                        sessionStorage.Sycl = txtSycl;
                        sessionStorage.Sywd = txtSywd;
                        sessionStorage.Sysc = txtSysc;
                        sessionStorage.SyType = txtSyType;
                        sessionStorage.SetLight = txtIntensity;
                        sessionStorage.SetInterval = txtInterval;
                        //$(".content-frame").each(function () {

                        //    $(this).contents().find("#Sycl").text(txtSycl);
                        //    $(this).contents().find("#cupNum").text(cupNum);
                        //})
                        top.layer.close(loadingIndex);
                        $("#example-basic").steps("next");
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(errorThrown);
                    }
                });



            });

            $(".home-btn").click(function () {
                $("#userinfo-btn", parent.document).removeClass("disabled");
                location.href = "Menu.html";
                $("#menu-title", parent.document).removeClass().addClass("fa fa-home").text(" 功能菜单");


            });

            function completion(txt) {

                shiyan = false;
                t = 0;
                swal({
                    title: "“" + txt + "”实验完成！",
                    text: "点击下一步进入到下一阶段",
                    type: "success",
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "下一步",
                    closeOnConfirm: false
                }, function () {
                    $("#example-basic").steps("next");
                });
            }


        })
        function stepNext() {
            $("#example-basic").steps("next");

        }
        function setTemp(temp) {

            $("#txtSywd").val(temp + "℃");
            $(".content-frame").contents().find("#Sywd").text(temp);
        }

    </script>
</body>
</html>